import { TypeOrmModuleOptions } from '@nestjs/typeorm';
import { RedisOptions } from 'ioredis';
type CONFIG_DB = TypeOrmModuleOptions;
type CONFIG_REDIS = RedisOptions;

type CONFIG_TYPE = {
  readonly port: number;
  readonly db: CONFIG_DB;
  readonly redis: CONFIG_REDIS;
  readonly jwt: 'pmp' | 'bill' | 'lostFound';
  readonly ossConfig: {
    accessKeyId: string;
    accessKeySecret: string;
    region: string;
    bucket: string;
  };
  readonly DEFAULT: string;
};

const config: CONFIG_TYPE = {
  port: 9999,
  db: {
    type: 'mysql',
    host: '127.0.0.1',
    port: 3306,
    username: 'fox',
    password: '123456',
    // database: 'lostFound',
    database: 'pmp',
    // database: 'bill_db',
    synchronize: false,
    entities: ['dist/**/*.entity{ .ts,.js}'],
    logging: true,
  },
  redis: {
    host: '127.0.0.1',
    port: 6379,
    connectionName: 'pmp',
    // connectionName: 'lostFound',
    // connectionName: 'bill',
  },
  jwt: 'pmp',
  // jwt: 'lostFound',
  // jwt: 'bill',
  ossConfig: {
    accessKeyId: '',
    accessKeySecret: '',
    region: '',
    bucket: '',
  },
  DEFAULT: 'pmp123456',
};

export default config;
